<?php

namespace App\Http\Requests\Validators\Backend\UserManage;

use App\Http\Requests\Validators\BaseValidator;

/**
 * 服务商信息验证
 */
class BusinessValidator extends BaseValidator
{
    public function storeRules()
    {
        return [
            'corporation_name' => 'required | string | max:100',
            'corporation_card_id' => 'required | string | max:100',
            'name' => 'required | string | max:50',
            'landline' => 'required | string | max:50',
            'user_id' => 'required | numeric',
            'resources' => 'required | array',
            'resources.licence' => 'required | array',
            'resources.card_id' => 'required | array',
            'types' => 'required | string',
            'province_id' => 'required | numeric',
            'city_id' => 'numeric',
            'area_id' => 'numeric',
            'serve_begin_time' => ' date_format:H:i',
            'serve_end_time' => 'date_format:H:i',
            'introduction' => 'string',
        ];
    }

    public function editRules()
    {
        return [
            'corporation_name' => 'string | max:100',
            'corporation_card_id' => 'string | max:100',
            'name' => 'string | max:50',
            'landline' => 'string | max:50',
            'user_id' => 'numeric',
            'resources' => 'array',
            'resources.licence' => 'array',
            'resources.card_id' => 'array',
            'types' => 'string',
            'province_id' => 'numeric',
            'city_id' => 'numeric',
            'area_id' => 'numeric',
            'serve_begin_time' => ' date_format:H:i',
            'serve_end_time' => 'date_format:H:i',
            'introduction' => 'string',
            'status' => 'in:1,2,3',
            'readed' => 'in:1,2',
        ];
    }

    public function searchRules()
    {

        return [
            'user_name' => 'string | max:50',
            'corporation_name' => 'string | max:100',
            'corporation_card_id' => 'string | max:100',
            'name' => 'string | max:50',
            'province_id' => 'numeric',
            'city_id' => 'numeric',
            'area_id' => 'numeric',
            'serve_begin_time' => ' date_format:Y-m-d H:i:s',
            'serve_end_time' => 'date_format:Y-m-d H:i:s',
            'introduction' => '',
            'status' => 'in:1,2,3',
            'readed' => 'in:1,2',
            'begin_time' => 'date_format:Y-m-d H:i:s',
            'end_time' => 'date_format:Y-m-d H:i:s',
        ];
    }
}
